package com.ibm.law.service.system;

import java.util.List;

import com.ibm.law.domain.Dictionary;
import com.ibm.law.service.DataAccessService;

public class DictionaryService extends DataAccessService<Dictionary> {
	public List<Dictionary> getRootDictionaries() {
		String jpql = "select  o from Dictionary o  where o.parent is null";
		return entityManager.createQuery(jpql, Dictionary.class)
				.getResultList();
	}

	public List<Dictionary> getSubDictionaries(Dictionary parent) {
		String jpql = "select  o from Dictionary o  where o.parent=?";
		return entityManager.createQuery(jpql, Dictionary.class)
				.setParameter(1, parent).getResultList();
	}
}
